/*
 * @Description: 
 * @Author: xuechengwu
 * @Email: 516385822@qq.com
 * @Date: 2022-02-09 09:57:24
 * @LastEditTime: 2022-02-09 16:02:14
 * @LastEditors: xuechengwu
 */
import Input from './component.vue';
import A5 from '../../A5';
import ValueEditor from './configView/ValueEditor.vue';
A5.registerComponent('xue-b-input', Input, {
    title: '输入框',
    isContainer: false,
    canSelect: true,
    display: 'block',
    getProps: () => ({
        value: 'Hello World'
    }),
    events: {
        change: {
            name: '内容变更',
        },
        input: {
            name: '输入事件',
            funcs: [{
                name: '修改绑定数据',
                key: 'PAGE_DATA_EDIT',
                callback(app, vm, value) {
                    const { updatePage } = app;
                    const { links = [] } = vm;
                    const link = links.find(vo => vo.path === 'data.value');
                    console.log('update link===>', link, value);
                    if (link) {
                        updatePage(`datas.${link.source}.value`, value);
                    }
                },
            }]
            // callback(app, vm, value) {
            //     return [];
            // }
        }
    },
    configView: [{
        title: '设置',
        view: ValueEditor,
        slots: [{
            name: 'value-link',
            path: 'data.value',
        }],
    }],
});